<!DOCTYPE html>
<html lang="zh-cmn-Hans">
  <head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="../../../static/mobile/default/css/layout.css?v=2"/>
    <link rel="icon" type="image/png" href="../../../static/favicon.ico"/>
    <script src="../../../static/js/jquery/jquery/2.1.4/jquery.min.js"></script>
    <script src="../../../static/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
    <script src="../../../static/mobile/default/js/page.js?v=1"></script>
    <title>实名认证  - 达漂亮</title>
          
<link rel="stylesheet" href="../../../static/mobile/default/css/picker.css"/>
<link rel="stylesheet" href="../../../static/mobile/default/css/userData.css" />
<link rel="stylesheet" href="../../../static/mobile/default/css/orderDetails.css" />


</head>
<body >
  <div class="page myOrder">
    		<div class="page-hd">
            <div class="header base-header bor-1px-b">
                <div class="header-left">
                    <a href="javascript:history.go(-1)" class="left-arrow"></a>
                </div>
                <div class="header-title">实名认证</div>
                <div class="header-right">
                    <!-- <a href=""></a> -->
                </div>
            </div>
        </div>
      
      <div class="page-bd ">
          <!-- 页面内容-->
    <div class="tab fs32">
        <div class="color_9 orderActive" data-type="all">个人认证</div>
        <div class="color_9" data-type="0">企业认证</div>
    </div>
    <div class="tabBox">
        <div class="block allBox">
            <form id="userform">
        <!-- 页面内容-->
        <div class="cells">
         
           <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">真实姓名</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="realName" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">身份证号码</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="idCard" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">手机号</span></div>
            <div class="cell_ft">
                <input type="number" value="" name="mobile" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">银行卡号</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="bankCard" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>

                <div class="cell_bd personal" style="margin-top:.4rem;     text-align: center;" ><span class="fs28 color_3 fw_b" style="    background: #f65236;
    color: white;
    width: 2rem;
    display: inline-block;
    padding: .1rem 0;
    border-radius: 20px;">确认</span></div>
  
                  </div> 
         
        </form>
        </div>
        <div class="block box 0Box">
                        <form id="userform1">
        <!-- 页面内容-->
        <div class="cells">
         
           <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">企业名称</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="companyName" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">统一社会信用代码</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="creditCode" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
           <div class="cell" style="    height: 2rem;">
             <div class="uploading" style="display: block; " >
            <div class="fs28 color_9">营业执照</div>
            <div class="uploadBox" style="flex-wrap: wrap;overflow: initial;    display: flex;">
                <ul class="weui-uploader__files uploaderFiles" id="uploaderFiles1">
                </ul>
                <div class="Box">
                    <img src="../../../static/mobile/default/images/addImg.png" alt="" class="imgBox">
                        <input id="uploadInput" onchange="uploadFile(this,event)" class="weui-uploader__input"
                               type="file"
                               accept="image/*" multiple="">
                </div>
                <input type="hidden" value="" name="busiLicenseUrl" class="fs28 color_3 fw_b inputbox busiLicenseUrl" >
                <div ></div>
            </div>
        </div> 
          </div>
          
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">法人姓名</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="realName" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">法人身份证</span></div>
            <div class="cell_ft">
                <input type="text" value="" name="idCard" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>
          <div class="cell">
              <div class="cell_bd">
            <span class="fs28 color_9">手机号</span></div>
            <div class="cell_ft">
                <input type="number" value="" name="mobile" class="fs28 color_3 fw_b inputbox" placeholder="请输入">
            </div>
          </div>

                <div class="cell_bd enterprise"  style="margin-top:.4rem;    text-align: center;"><span class="fs28 color_3 fw_b" style="    background: #f65236;
    color: white;
    width: 2rem;
    display: inline-block;
    padding: .1rem 0;
    border-radius: 20px;">确认</span></div>
                  </div> 
         
        </form>
        </div>
    </div>
      
        
        <!--<div class="page-ft">-->
        <!--    <span class="fs32 color_w fw_b BGcolor_r postBtn">保存</span>-->
        <!--  </div>-->

</div>
     

  </div>

<script src="../../../static/js/art-template.js"></script>
<script src="../../../static/mobile/default/js/lib/fastclick.js"></script>
<script src="../../../static/js/jquery/lazyload/jquery.lazyload.js"></script>
<!--<script src="../../../static/mobile/default/js/uploadsimage.js?v=1"></script>-->
<script>
    $(function() {
        FastClick.attach(document.body);
		$("img.lazy").lazyload({effect:"fadeIn",event:"scroll",container:$(".page-bd")});
    });
    
          share()
     function  share(){
    /***用户点击分享到微信圈后加载接口接口*******/
        var url=window.location.href;
        console.log("url:"+url);
            $.ajax({
		    url: "/api/mp/wxconfig",
		    type: "post",
		    data:{shareUrl:url},
		    headers:{ token: $.cookie('code')},
		    dataType: "json",
		    success: function(data){
		         configData = {
                    debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                    appId: data.data.appid, // 必填，公众号的唯一标识
                    timestamp: data.data.timestamp, // 必填，生成签名的时间戳
                    nonceStr: data.data.nonceStr, // 必填，生成签名的随机串
                    signature: data.data.signature,// 必填，签名，见附录1
                    jsApiList : ['hideOptionMenu']
                    // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
               };
               
               //step2:注入配置信息
               wx.config(configData);
               //step3:通过ready接口处理成功验证
               wx.ready(function () {
                   // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
//                 alert("执行ready方法");
//                 wx.checkJsApi({
//                      jsApiList: ['chooseImage'] // 需要检测的JS接口列表，所有JS接口列表见附录2,
//                      success: function(res) {
//                      // 以键值对的形式返回，可用的api值true，不可用为false
//                      // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
//                      }
//                 });
                   //接口1:获取网络类型
                    wx.getNetworkType({
                        success: function (res) {
                          oldNet = res.networkType; // 返回网络类型2g，3g，4g，wifi
//                        alert("网络类型"+ oldNet);
                        }
                     });
                   //禁用右上角菜单按钮
                   wx.hideOptionMenu();
		    })
		    },
		    error: function() {
// 			    _alert('ajax request failed!!!!');
			    return;
		    } 
        })

	    
	    
	    }
</script>

<script src="../../../static/mobile/default/js/datePicker.js"></script>
<script src="../../../static/mobile/default/js/picker.min.js"></script>
 <script>
 var  user_id = getUrlParam('user_level_id')?getUrlParam('user_level_id'):''
 console.log('user_id',user_id)
 var nowPage = [],getAgain = [],isLoadend = [];
 var _type = 'all';
 
 	 $('.tab div').on('click',function(){
            var index=$(this).index();
            _type = $(this).data('type');

                isLoadend[_type] = false;
                getAgain[_type] = false;
                // getList();//执行加载
   
            $(this).addClass('orderActive')
            $(this).siblings().removeClass('orderActive')
            $('.block').eq(index).show();
            $('.block').eq(index).siblings().hide();
        })
        $('.tab div').each(function () {
            if ($(this).data('type') == _type){
                $(this).trigger('click');
                isLoadend[_type] = false;
                getAgain[_type] = false;
            }
        })
                </script>
    <script>
    
    
      $(function(){
        $('#nowValue').on('click',function(){
          demoClick()
        })
        $('.inputbox').on('click',function(){
          $(this).val('')
        })
        $('.picker-mask').on('click',function(){
          $('.picker').hide();
        })
      })
    // 日期选择器
    function demoClick() {
      var nowValue = document.getElementById('nowValue');
        new DatePicker({
            "type": "3",//0年, 1年月, 2月日, 3年月日
            "title": '请选择日期',//标题(可选)
            "maxYear": "",//最大年份（可选）
            "minYear": "",//最小年份（可选）
            "separator": ".",//分割符(可选)
            "defaultValue": nowValue.value,//默认值（可选）
            "callBack": function (val) {
                //回调函数（val为选中的日期）
                nowValue.value = val;
            }
        });
    }
      //性别选择
      var obj=document.getElementById('sex')
      var data1 = [
          {
            text:'男',
            value: '1',
          }, {
            text:'女',
            value: '2',
          }
      ];
      //初始化picker
      var picker = new Picker({
          data: [data1],
          selectedIndex: [0],
          title: '请选择性别'
      });
      //选择后的内容赋值
      picker.on('picker.select', function (selectedVal, selectedIndex) {
        obj.value = data1[selectedIndex].text;
      })
      //点击弹出选项框
    //   obj.addEventListener('click', function () {
    //       picker.show();
    //   });

var fd = new FormData();

$('.personal').click(function(){
    if(!$('input[name=realName]').val()){
         _alert('请输入姓名');
         return
    }else if(!$('input[name=idCard]').val()){
        _alert('请输入身份证号码');
        return
    }else if($('input[name=idCard]').val().length<18){
         _alert('请输入正确的身份证号码');
         return
    }else if(!$('input[name=mobile]').val()){
        _alert('请输入手机号码');
        return
    }else if($('input[name=mobile]').val().length<11){
        _alert('请输入正确的手机号码');
        return
    }
    // else if(!$('input[name=bankCard]').val()){
    //     _alert('请输入银行卡号');
    //     return
    // }
	var data = $('#userform').toJson();
	
	
	$.ajax({
		  url: '/api/mp/personCert',
		  type: 'get',
		  headers:{'token': $.cookie('code')},
		  contentType: "application/json",
		  data: data,
		  success: function (res) {

		      if (res.errno != 0){
				  _alert(res.errmsg);
				  return false;	
			  }
			  window.location.href ='./contract.html?user_level_id='+user_id
             
		  }
	})
})

$('.enterprise').click(function(){
    if(!$('#userform1 input[name=companyName]').val()){
         _alert('请输入企业名称');
         return
    }else if(!$('#userform1 input[name=creditCode]').val()){
        _alert('请输入统一社会信用代码');
        return
    } else if(!$('#userform1 input[name=busiLicenseUrl]').val()){
        _alert('请上传营业执照');
        return
    }else if(!$('#userform1 input[name=realName]').val()){
        _alert('请输入法人姓名');
        return
    }else if(!$('#userform1 input[name=idCard]').val()){
        _alert('请输入法人身份证');
        return
    }else if(!$('#userform1 input[name=idCard]').val().length<18){
        _alert('请输入正确的法人身份证');
        return
    }else if(!$('#userform1 input[name=mobile]').val()){
        _alert('请输入手机号码');
        return
    }else if($('#userform1 input[name=mobile]').val().length<11){
        _alert('请输入正确的手机号码');
        return
    }
	var data = $('#userform1').toJson();
	
	$.ajax({
		  url: '/api/mp/companyCert',
		  type: 'get',
		  headers:{'token': $.cookie('code')},
		  contentType: "application/json",
		  data: data,
		  success: function (res) {

		      if (res.errno != 0){
				  _alert(res.errmsg);
				  return false;	
			  }
			  window.location.href ='./contract.html'
             
		  }
	})
})



 //选择上传图片
    function uploadFile(_this,e){

        var formData = new FormData($("#uploadForma")[0])  //创建一个forData
        formData.append('file', $('#uploadInput')[0].files[0]) //把file添加进去  name命名为img
        $.ajax({
            url: '/api/mp/upload',
            data: formData,
            type: "POST",
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (data) {

                if (data.errno != 0) {
                    _alert(data.errmsg);
                    return false;

                }
                $('.busiLicenseUrl').val(data.data)
                // imgNum++;
                // fd.append("imgfile["+imgNum+"]", data.url);
                
                $('#uploaderFiles1').before('<div class="Box"><img src="'+ data.data+'" alt="" class="imgBox payimg"><img src="../../../static/mobile/default/images/closeImg.png" alt=""  class="closeImg" onclick="closeImg(this)"></div>');
                var test =  $('.uploadBox .Box')
                if($('.uploadBox .Box').length >2){
                      $('.uploadBox .Box').eq(0).remove()
                }
              
            },
            error: function () {
                //失败
            }

        });

    }
    //关闭图片
        function closeImg(obj) {
            // var id = $(obj).attr('data-id');
            $('.uploadBox .Box').eq(0).remove()
            $('.busiLicenseUrl').val('')
        }
</script>

  <div class="alertBox">
      <div class="alertBG"></div>
      <div class="alert">
          <div class="text fs30 color_3 bor_b">

          </div>
          <!-- 单按钮 -->
          <div class="button fs32 fw_b color_r">
              知道了
          </div>
          <!-- 双按钮 -->
          <div class="buttonBox fs32 fw_b">
              <span class="color_9 bor_r cancel">取消</span>
              <span class="color_r confirm">确定</span>
          </div>
      </div>
  </div>
  <script type="text/javascript">
      var is_xcx = 0;
      $(document).on('click', 'a', function () {
          var href = $(this).attr('href');
          if (href.indexOf('/pages') != -1) {
              if (is_xcx == 1) {
                  wx.miniProgram.navigateTo({
                      url: href
                  })
                  return false;
              } else {
                  return false;
              }
          }
      })
  </script>
    </body>
</html>